package com.webflux.sample.webfluxapp.remote;

import com.webflux.sample.webfluxapp.dto.MessageDTO;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(
    name = "web-message-feign",
    url = "http://localhost:8080",
    qualifiers = "web-message-feign"
)
public interface MessageFeign {

  @GetMapping("/info/test")
  String testInfo(@RequestParam("name") String name);

  @GetMapping("/info/{id}")
  MessageDTO getById(@PathVariable("id") Long id);

  @GetMapping("/info/list-all")
  List<MessageDTO> listAll();

  @PostMapping("/info/save")
  MessageDTO save(@RequestBody MessageDTO message);

}
